#!/bin/bash
~/bin/gc.sh $0 $1 $2 $3 $4 $5 $6 $7 $8 $9

exit
#end
program CountSrcFile;

reference "core.desl";
reference "netutil.desl";
reference "chrome.desl";

pattern main(Codebase = ".", Version="1.0", Name="gc10", Output = null) {
	var fileCount = new HashMap();
	var output = Output ?? ("sourcefile-" + Name + ".csv"); 
	
	match ProcessFolder arguments 
		Folder = Codebase,
		FileProcessor = statement {
			var folder = ProcessingFile.getParentFile();
			fileCount.put(folder, (fileCount.get(folder) ?? 0) + 1);
		};
	var res = new CsvFile(output);
	res.writeln("XmlBlameFile, FileCount, Folder");
	
	foreach(var f in fileCount.keySet()) {
		var fn = f.getName();
		var path = f.getAbsolutePath();
		res.writeCsvLine({fn + "-" + Integer.toHexString(path.hashCode()) + ".xml", 
					fileCount.get(f), f
		});
	}
	res.close();
}